﻿@model HZU.ZP.Domain.Model.Position
@{
    Layout = "_CompanyLayout";
}
<script>
    $(document).ready(function () {
        $("button").click(function () {
            $.ajax({
            type: 'post',
            url: '/Position/Update',
            data: 'email=@User.Identity.Name&id=@Model.Id' + '&status=' + $(this).data("status"),
            success: function (message) {
                if (message.returnCode == "001") {
                    alert("保存成功");
                    location.reload();
                }
                else if (message.returnCode == "4040") {
                    alert("企业还未通过管理员审核，不能发布职位！");
                } else if (message.returnCode == "4050") {
                    alert("只能保留10个职位信息！");
                } else if (message.returnCode == "4070") {
                    alert("职位不存在！");
                }
            }
        });
        });
        $("#delete").click(function () {
            if (confirm("确实要删除吗？")) {
                $.ajax({
                    type: 'post',
                    url: '/Position/Delete',
                    data: 'id=@Model.Id',
                    success: function (message) {
                        if (message.returnCode == "001") {
                            alert("删除成功！");
                            location.href = "/Position/GetComPosition?email=@User.Identity.Name&status=@Model.Status";
                        } else if (message.returnCode == "4070") {
                            alert("职位不存在！");
                        }
                    }
                });
            }
            else {
            }
        });
    });
</script>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h3>@Model.Name</h3>
            <p><a href="/CompanyInformation/GetCompanyInformationA?companyId=@Model.CompanyId" style="color:black">@Model.CompanyName</a></p>
            <p>
                @Model.Provincial-@Model.Municipal&nbsp;|&nbsp;@Model.BigPosition-@Model.SmallPosition&nbsp;|&nbsp;
                @Model.Salary&nbsp;|&nbsp;招@(Model.RecruitNumber)&nbsp;|&nbsp;
                @(Model.CreateTime.ToString("yyyy-MM-dd"))&nbsp;发布
            </p>
            <dl>
                <dt>
                    职位描述
                </dt>
                <dd>
                    <textarea style="border:none; height:128px;width:98%" readonly>@Model.JobDescription</textarea>
                </dd>
                <dt>
                    职位要求
                </dt>
                <dd>
                    <textarea style="border:none; height:128px;width:98%" readonly>@Model.JobRequirement</textarea>
                </dd>
            </dl>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-6 column">
            <div class="form-group">
                <a id="delete" class="btn btn-default btn-danger" style="float:right;">删除</a>
            </div>
        </div>
        <div class="col-md-6 column">
            <div class="form-group">
                @if (Model.Status == 1)
                {
                    <button type="button" class="btn btn-primary btn-default" style="float:left;" data-status="3">暂停职位</button>
                }
                else if (Model.Status == 2)
                {
                    <button type="button" class="btn btn-primary btn-default" style="float:left;" data-status="1">发布职位</button>
                }
                else if (Model.Status == 3)
                {
                    <button type="button" class="btn btn-primary btn-default" style="float:left;" data-status="1">恢复职位</button>
                }
                else
                {
                    <h4 style="color:red">该条职位数据有误，请删除重新添加！</h4>
                }
            </div>
        </div>
    </div>
</div>